<?php 
	session_start();
	require("connect.php");
?>
<html><!-- InstanceBegin template="/Templates/temp02.dwt.php" codeOutsideHTMLIsLocked="false" -->
<style type="text/css">
<!--
#subcontent {
	position:absolute;
	left:243px;
	top:0px;
	width:706px;
	height:59px;
	z-index:1;
	background-color: #70a972;
}
#subcontent01 {
	position:absolute;
	left:22px;
	top:11px;
	width:287px;
	height:39px;
	font:Tahoma;
	font-size:30px;
	font-weight:600px;
	color:#E8E8E8;
	z-index:1;
}
#subcontent02 {
	position:absolute;
	left:312px;
	top:29px;
	font:Tahoma;
	font-size:18px;
	font-weight:500px;
	color:#E8E8E8;
	width:199px;
	height:25px;
	z-index:2;
}
#search01 {
	position:absolute;
	left:1px;
	top:73px;
	width:202px;
	height:69px;
	z-index:1;
}

#searchname {
	position:absolute;
	left:0px;
	top:0px;
	width:202px;
	height:30px;
	z-index:1;
	background-color: #70a972;
	font-family:Tahoma;
	font-size:14px; color:#FFFFFF;
	padding-left:20px;
	padding-top:7px;
}
#text {
	position:absolute;
	left:31px;
	top:37px;
	width:137px;
	height:28px;
	z-index:1;
}
#Layer2 {
	position:absolute;
	left:279px;
	top:353px;
	width:705px;
	height:79px;
	z-index:1;
}
#searchname01 {
	position:absolute;
	left:0px;
	top:0px;
	width:202px;
	height:72px;
	z-index:2;
}
#searchname02 {
	position:absolute;
	left:0px;
	top:0px;
	width:202px;
	height:30px;
	z-index:3;
	background-color: #70a972;
	font-family:Tahoma;
	font-size:14px; color:#FFFFFF;
	padding-left:20px;
	padding-top:7px;
}
#searchname03 {
	position:absolute;
	left:29px;
	top:38px;
	width:139px;
	height:25px;
	z-index:2;
}
#textname {
	position:absolute;
	left:71px;
	top:563px;
	width:164px;
	height:26px;
	z-index:2;
}
#searchtotal {
	position:absolute;
	left:10px;
	top:223px;
	width:204px;
	height:180px;
	z-index:1;
}
.text{
	font-family:Tahoma;
	font-size:14px; color:#0033FF;
	width:135px;
	height:22px;
}
#button {
	position:absolute;
	left:56px;
	top:150px;
	width:78px;
	height:26px;
	z-index:1;
}
-->
</style>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- InstanceBeginEditable name="doctitle" -->
<title>Untitled Document</title>
<link rel="stylesheet" type="text/css" href="css/product.css" />
<style type="text/css">
.style7 {
	border: 1px outset #0099FF;
	text-transform: none;
	background-color: #FFFFFF;
}
</style>
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
</head>

<body>
<?php 
function GetQuantity($id){
		$cart = $_SESSION["CART"];
		$quantity=0;
		foreach(array_keys($cart) as $value){
			if($value == $id){
				$quantity = $cart[$id];
				break;
			}
		}
		return $quantity;	
	} 
?>
<div id="wrap">
	<?php
		if($_SESSION["userlogin"] == false){
	?>
	<div id="title">
		<div id="title01">
			<span><a href="register.php">Register </a>|<a href="cart.php"> My Cart </a>|<a href="login.php"> Login </a></span>
		</div>
	</div>
	<?php } else {?>
	<div id="title">
		<div id="title02">Wellcome <?php echo $_SESSION["username"];?> to MyShop</div>
		<div id="title01">
			<span><a href="user_detail.php?uid=<?php echo $_SESSION["uid"];?>">My Acount </a>|<a href="cart.php?uid=<?php echo $_SESSION["uid"];?>"> My Cart </a>|<a href="logout.php"> Logout </a></span>
		</div>
	</div>
	<?php }?>
	<div id="header">
		<div id="searchform">
	    	<form action="search.php" name="f1" method="post">
					<input type="text" name="s" value="" onKeyPress="this.style.backgroundColor='pink'" onBlur="this.style.backgroundColor='white'" onFocus="this.style.backgroundColor='pink'"/>
			</form>
		</div>
	</div>
	<div id="menu">
		<ul>
			<li><a href="index.php">TRANG CHỦ</a></li>
			<li><a href="introduce.php">GIỚI THIỆU</a></li>
			<li><a href="product_view.php">SẢN PHẨM</a></li>
			<li><a href="promotion.php">KHUYẾN MẠI</a></li>			
			<li><a href="tuvan.php">TƯ VẤN THIẾT BỊ</a></li>
			<li><a href="feedback.php">PHẢN HỒI</a></li>
		</ul>
   </div>
   <div id="submenu">
   		<div id="submennu01"><a href="#">Uy tín/Chất lượng</a></div>
  </div>
   <div id="center">
   		<div id="left">
			<div id="danhmuc"><a href="product_view.php?catid=0">DANH MỤC SẢN PHẨM</a></div>
			<div id="left01">
			  <?php 
					$sql=mysql_query("select * from catagory");
					while($row=mysql_fetch_array($sql))
					{
					   
						echo "<a href='product_view.php?catid={$row["catID"]}'>{$row["catName"]}</a><br>";
						echo "<font color=#727272 >-------------------------------</font><br>";
					}
			?>
			</div>
			<form action="search.php" name="search" method="get" id="search">
			<div id="searchtotal">
			
				<div id="searchname01">
					<div id="searchname02">Tìm sản phẩm theo tên</div>
					<div id="searchname03">
				    <input name="txtkeyword" type="text" class="text" value="">
				  </div>
		  	    </div>
				<div id="search01">
					<div id="searchname">Tìm sản phẩm theo giá</div>
					<div id="text">
					  <select name="slprice" class="text" id="slprice">
                                     <option selected>sản phẩm có giá:</option>
                                     <option value="1">Từ 1 triệu -&gt; 2 Triệu</option>
                                     <option value="2">Từ 2 triệu -&gt; 4 Triệu</option>
                                     <option value="3">Từ 4 triệu -&gt; 6 Triệu</option>
                                     <option value="4">Từ 6 triệu -&gt; 8 Triệu</option>
                                     <option value="5">Từ 8 triệu -&gt; 10 Triệu</option>
                                     <option value="6">Từ 10 triệu trở lên</option>
                  	  </select>
			      </div>				
	    	  </div>			 
			  <div id="button">
		      <input type="submit" name="cmdsearch" value="Tìm Kiếm" style="color:#FF6633;"></div>			   
			</div>
			</form>
			<div id="giohang">
				<div id="giohang01"><a href="cart.php">GIỎ HÀNG CỦA BẠN</a></div>
		  </div>
			<div id="cart">
			  <?php include("cartdetail.php");?></div>
		</div>
		<div id="subcontent">
			<div id="subcontent01">NỘI THẤT CAO CẤP</div>
			<div id="subcontent02">UY TÍN - CHẤT LƯỢNG</div>
		</div>
		<div id="content"><!-- InstanceBeginEditable name="vungsuaduoc" -->
		<table width="98%" height="798" border="0" align="center" cellpadding="0" cellspacing="0">
              <tr>
                <td align="center" valign="top"><fieldset>
                  <legend></legend>
                  <table width="95%" height="168" border="0" cellpadding="0" cellspacing="0">
                    <tr>
                      <td height="127"><?php 
		if($_SESSION["userlogin"] == false){
			echo "<center><font tahoma color=red><h3><b>Bạn phải đăng nhập trước khi mua hàng!</h3></font><br><h4>Đăng ký thành viên<a href=register.php><font color=red> &nbsp;Tại đây</a>!</b></h4></font></center>";
		
			        $_SESSION["loi"] = "Mời đăng nhập!";
			        echo "<script>setTimeout(\"window.location='login.php';\",4000);</script>";
		} else {
		
		echo "<form method=post action=checkout_action.php>";
		echo "<table border=0 align=center>";
		echo "<tr><td><b>Tên người nhận:</b></td>";
		echo "<td><input type=text name=t1></td></tr>";
		echo "<tr><td><b>Địa chỉ người nhận:</b></td><td><input type=text name=t2></td></tr>";
		echo "<tr><td><b>Điện thoại người nhận:</b></td><td><input type=text name=t3></td></tr>";
		echo "<tr><td colspan=2><i><font color=red>*</font>Nếu để trống tất cả thì sẽ lấy thông tin đăng nhập!</i></td></tr>";
		echo "<tr><td align=right><input type=submit value='::Đặt hàng::' class=style7></td><td><input type=reset value='::Nhập lại::' class=style7></td></tr></table>";
		
		}
	?></td>
                    </tr>
                  </table>
                  <p>&nbsp;</p>
                </fieldset>&nbsp;</td>
              </tr>
            </table>
		<!-- InstanceEndEditable --></div>
   </div>
   <div id="footer01">
  		<center><a href="#">Design By H3TL&nbsp;Group3<br> Mọi thông tin chi tiết xin liên hệ: h3tl.itpro@gmail.com</a></center>
  </div>
   
</div>





<div id="Layer3"></div>
</body>
<!-- InstanceEnd --></html>
